
Page({
  data: {
    sUrl: '/assets/icon/',
    name: "",
    //isLogined: wx.getStorageSync('flag'),供登录使用
    bottonClr: [
      "white", "white", "white", "white", "white", "white", "white"
    ], 
    setArr: [
      { id: "1", name: "保安信息", img: "ticket", margin: "0" },
      { id: "2", name: "考勤记录", img: "medal", margin: "30" },
      { id: "3", name: "联系值班室", img: "chat", margin: "0" },
      { id: "6", name: "管理员登录", img: "option", margin: "40" },
      //{ id: "5", name: "问题反馈", img: "chat", margin: "40" },
    ],
  },

  tap(e) {
    switch (e.currentTarget.id) {
      case "1": 
        wx.navigateTo({ url: '../info/info', });
        break;
      case "2": 
        wx.showToast({
          image: '/assets/fail.png',
          title: '暂未开放使用',
        })
        break;
      case "3": 
        wx.modal('值班室未提供号码', 
          '您将拨打至:\n0571-28877110',
          '取消', '拨打'
        ).then(() => {
          wx.makePhoneCall({ phoneNumber: '057128877110' })
        })
        break;
      case "4": wx.navigateTo({ url: '../favorites/favorites', }); break;
      case "5": wx.navigateTo({ url: '../help/help', }); break;
      case "6": wx.navigateTo({ url: '../../admin/login/login', }); break;
    }
    
  },

//******************************************
  CA: function(e) { this.setData({[`bottonClr[${e.currentTarget.id}]`]: "#ddd" })},
  CB: function(e) { this.setData({[`bottonClr[${e.currentTarget.id}]`]: "#fff" })},

  onShow:function(){
    
  },

  onLoad: function(op) {
    var that = this, UBIG_data = { user_id: wx.appData.user_id };
    wx.req('userBasicInfoGet', UBIG_data).then((res) => {
      console.log(res.odr, res.data);
      wx.appData.user = res.data.data[0]
      console.log(wx.appData.user)
      this.setData({ name: wx.appData.user.username })
    })
  },

})